import dayjs from "dayjs";
import type { ConfigItem, CurrentInfo } from "@/views/home/types";

export const columns = [
  {
    title: "任务名称",
    dataIndex: "taskTitle",
    ellipsis: true,
    tooltip: true
  },
  {
    title: "负责人",
    dataIndex: "userName",
    ellipsis: true,
    tooltip: true
  },
  {
    title: "关联客户",
    slotName: "customerName",
    ellipsis: true,
    tooltip: true
  },
  {
    title: "住户地址",
    dataIndex: "residence",
    ellipsis: true,
    tooltip: true
  },
  {
    title: "计划开始日期",
    dataIndex: "plainStartDate",
    ellipsis: true,
    tooltip: true
  },
  {
    title: "实际开始日期",
    dataIndex: "factStartDate",
    ellipsis: true,
    tooltip: true
  },
  {
    title: "计划完成日期",
    dataIndex: "plainEndDate",
    ellipsis: true,
    tooltip: true
  },
  {
    title: "实际完成日期",
    dataIndex: "factEndDate",
    ellipsis: true,
    tooltip: true
  },
  {
    title: "任务状态",
    dataIndex: "postponeStatus",
    ellipsis: true,
    tooltip: true
  },
  {
    title: "是否外出",
    dataIndex: "isOut",
    ellipsis: true,
    tooltip: true
  },
  {
    title: "延期申请天数",
    dataIndex: "delayDays",
    ellipsis: true,
    tooltip: true
  },
  {
    title: "操作",
    slotName: "operate",
    width: 150,
    fixed: "right"
  }
];

/**
 * 审批&消息
 */
export const auditAndMessageType: ConfigItem[] = [
  {
    label: "审批",
    value: "audit",
    count: 0 //需要我审批的
  },
  {
    label: "处理",
    value: "message",
    count: 0 //需要我处理的
  }
];
// 审批
export const auditType: ConfigItem[] = [
  {
    label: "我审批的",
    value: "processAccept",
    count: 0
  },
  {
    label: "我发起的",
    value: "processSend",
    count: 0
  }
];
export const auditStatus: ConfigItem[] = [
  {
    label: "全部",
    value: "all",
    count: 0
  },
  {
    label: "待审批",
    value: "untreated",
    count: 0
  },
  {
    label: "已审批",
    value: "treated",
    count: 0
  }
];
export const auditStatusValue = {
  untreated: "1", // 待审批
  agreed: "4",
  refused: "5"
};
// 消息
export const messageType: ConfigItem[] = [
  {
    label: "我收到的",
    value: "msgAccept"
  },
  {
    label: "我发起的",
    value: "msgSend"
  }
];
export const messageStatus: ConfigItem[] = [
  {
    label: "未读",
    value: "unread",
    count: 0
  },
  {
    label: "未处理",
    value: "untreated",
    count: 0
  },
  {
    label: "已读/已处理",
    value: "readAndTreated",
    count: 0
  }
];
export const msgTypes = new Map([
  ["1", "合同"],
  ["2", "设计"],
  ["3", "施工"],
  ["4", "其他"]
]);
export const msgStatusValue = {
  untreated: 1,
  confirmedAndReviewed: 2,
  confirmed: 3, // 已确认
  agreed: 4, // 审批-已同意
  refused: 5, // 已拒绝
  withdrawn: 6
};
export const msgConfirmParams = {
  msgId: "",
  status: "confirmed",
  opinionInfo: "",
  resourceUrls: []
};

/**
 * 待办
 */
export const timeRange = [
  {
    label: "今日",
    value: "today"
  },
  {
    label: "两天内",
    value: "quarter"
  },
  {
    label: "本周内",
    value: "week"
  },
  {
    label: "本月内",
    value: "month"
  },
  {
    label: "自定义时段",
    value: "custom"
  }
];

/**
 * 待办->当前任务数据
 */
export const customerInfoParam: CurrentInfo = {
  customerId: "",
  currentTaskTitle: "",
  currentCommonId: "",
  currentType: -1
};

/**
 * 跟进
 */
const nowDate = dayjs().format("YYYY-MM-DD HH:mm:ss");
export const followFormInit: any = {
  customerId: "",
  trackType: "",
  trackDatetime: nowDate,
  contentDesc: "",
  crmFileCreateVOList: [],
  isNextSetting: 0,
  nextDateTine: nowDate,
  nextTime: nowDate,
  nextContent: "",
  stageTaskId: ""
  // nextUserIdsList: []
};
